<?php

class Dev
{
    public static $mode = 'development';

    private static function prompt($msg)
    {        
        if (!empty($msg))
        {
           echo $msg, '<br />';
        }
    }

    public static function vr($data, $msg='')
    {
        self::prompt($msg);
        var_dump($data);
        echo '<br /><br />';
    }

    public static function ve($data, $msg='')
    {
        self::prompt($msg);
        var_dump($data);
        exit;
    }

    public static function er($data, $msg='')
    {
        self::prompt($msg);
        echo $data;
        echo '<br /><br />';
    }

    public static function ee($data, $msg='')
    {
        self::prompt($msg);
        echo $data;
        exit;
    }

    public static function pr($data, $msg='')
    {
        self::prompt($msg);
        echo '<pre>';
        print_r($data);
        echo '</pre>';
        echo '<br /><br />';
    }

    public static function ph($data, $msg='')
    {
        self::prompt($msg);
        echo '<pre>';
        print_r($data);
        echo '</pre>';
        echo '<hr />';
    }

    public static function pe($data, $msg='')
    {
        self::prompt($msg);
        echo '<pre>';
        print_r($data);
        echo '</pre>';
        exit;
    }

    public static function log($data)
    {
        \think\Db::name('log')->insert($data);
    }

    public static function logTitle($data)
    {
        self::log(['title' => $data]);
    }

    public static function logContent($data)
    {
        self::log(['content' => $data]);
    }

    public static function logReturn($data)
    {
        self::log(['return' => $data]);
    }

    // var_dump(function_exists('dater')); => false;
    public static function YMDHISOfDateTimeWithLine()
    {
        return date('Y-m-d H:i:s');
    }

    public static function YMDHISOfDateTime()
    {
        return date('YmdHis');
    }

    // var_dump(function_exists('dat')); => false;
    public static function YMDOfDateTimeWithLine()
    {
        return date('Y-m-d');
    }

    // var_dump(function_exists('dt')); => false;
    public static function YMDOfDateTime()
    {
        return date('Ymd');
    }
}